package ooday04;

public class Test {
    public static void main(String[] args) {
        Object ob=new Dog(66,"犬夜叉","");
        if(ob instanceof Swim){
            ((Swim)ob).swim();
           // ((Fish)ob).drink();
        }
        double f=-344.25f;
//        StringBuffer sb2=new StringBuffer(55.0);
//        StringBuilder sb=new StringBuilder(,f);
      String s=Double.toString(f);
        char[] c=s.toCharArray();

        for(int i=0;i<c.length;i++){
            if(!Character.isDigit(c[i]))
            System.out.println(c[i]+"不是整数");
            else
                System.out.println(c[i]);
        }

        Animal[] animals = new Animal[5];
        animals[0] = new Dog(3, "小黑", "黑色");
        animals[1] = new Fish(3, "小金", "金色");
        animals[2] = new Chick(5, "小花花", "花白");
        animals[3] = new Chick(2, "小公鸡", "棕色");
        animals[4] = new Fish(2, "花白鲢", "白");
        for (int i = 0; i < animals.length; i++) {
           if(animals[i] instanceof Dog){
               Dog d=(Dog) animals[i];
               d.lookHome();
           }
            if(animals[i] instanceof Fish){
                Fish d=(Fish) animals[i];
                d.spitBubbles();
            }
            if(animals[i] instanceof Chick){
                Chick d=(Chick) animals[i];
                d.layEggs();
            }
            if(animals[i] instanceof Swim){
                Swim d=(Swim) animals[i];
                d.swim();
            }
        }



//        Master master=new Master();
//        master.feed(animals[3]);
       // Dog d=(Dog) new Animal(3,"","");
    }
    public static   void set(){
        if(true){
            set();
        }
    }
    public static void set2(){
        set();
    }
}
